<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.1.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"example.com","root":"/","images":"/images","scheme":"Pisces","darkmode":false,"version":"8.11.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"}}</script><script src="/js/config.js"></script>

    <meta name="description" content="DirectUI介绍DirectUI是一个软件设计思想，这个思想来源于Windowless理念，这个思想可以表述为“只有主窗口有句柄，其他的窗口都是以控件的形式被绘制出来”，所有采用这个思想设计的开发框架都可以称为DirectUI。目前流行的DirectUI库开源的有duilib，REDUI，Bkuilib， UIFeature， 以及国内有名的几家做UI库的公司的产品，例如上海勇进，炫彩界面库，">
<meta property="og:type" content="article">
<meta property="og:title" content="DirectUI介绍">
<meta property="og:url" content="http://example.com/2021/07/06/Windows-DirectUI/index.html">
<meta property="og:site_name" content="Youan">
<meta property="og:description" content="DirectUI介绍DirectUI是一个软件设计思想，这个思想来源于Windowless理念，这个思想可以表述为“只有主窗口有句柄，其他的窗口都是以控件的形式被绘制出来”，所有采用这个思想设计的开发框架都可以称为DirectUI。目前流行的DirectUI库开源的有duilib，REDUI，Bkuilib， UIFeature， 以及国内有名的几家做UI库的公司的产品，例如上海勇进，炫彩界面库，">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-07-05T16:00:00.000Z">
<meta property="article:modified_time" content="2022-12-06T07:37:04.197Z">
<meta property="article:author" content="lee">
<meta property="article:tag" content="duilib">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="http://example.com/2021/07/06/Windows-DirectUI/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://example.com/2021/07/06/Windows-DirectUI/","path":"2021/07/06/Windows-DirectUI/","title":"DirectUI介绍"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>DirectUI介绍 | Youan</title>
  





  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">Youan</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">好记性不如烂笔头</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
  </ul>
</nav>




</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#DirectUI%E4%BB%8B%E7%BB%8D"><span class="nav-number">1.</span> <span class="nav-text">DirectUI介绍</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">lee</p>
  <div class="site-description" itemprop="description">记录备份</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">10</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">12</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/wslmh" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;wslmh" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:wslmh@outlook.com" title="E-Mail → mailto:wslmh@outlook.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/07/06/Windows-DirectUI/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="lee">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Youan">
      <meta itemprop="description" content="记录备份">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="DirectUI介绍 | Youan">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          DirectUI介绍
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-07-06 00:00:00" itemprop="dateCreated datePublished" datetime="2021-07-06T00:00:00+08:00">2021-07-06</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2022-12-06 15:37:04" itemprop="dateModified" datetime="2022-12-06T15:37:04+08:00">2022-12-06</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/duilib/" itemprop="url" rel="index"><span itemprop="name">duilib</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="DirectUI介绍"><a href="#DirectUI介绍" class="headerlink" title="DirectUI介绍"></a>DirectUI介绍</h1><p>DirectUI是一个软件设计思想，这个思想来源于Windowless理念，这个思想可以表述为“只有主窗口有句柄，其他的窗口都是以控件的形式被绘制出来”，所有采用这个思想设计的开发框架都可以称为DirectUI。目前流行的DirectUI库开源的有duilib，REDUI，Bkuilib， UIFeature， 以及国内有名的几家做UI库的公司的产品，例如上海勇进，炫彩界面库，另外腾讯，迅雷这些公司都有自己的DirectUI库，只是他们不公开，只是自己的产品用。</p>
<p>因为有句柄的窗口消息和原理的公开所以使得它很容易被破解，降低了窗口信息的不安全性，所以就有人想给窗口加上锁来保证窗口信息的安全。 最早加锁的人还是微软自己，MSN要保护用户隐私，搞了个DirectUIHWND，被人发现后，DirectUI这个名称就逐渐扩散开来，也有越来越多的软件给自己的窗口加了锁。</p>
<pre><code>用 DirectUI框架开发的程序本质上是一个Win32程序。与MFC相比较，区别是除了主窗口之外的各种窗口和控件是由微软来实现还是UI库自己实现。各种不同的UI库是通过WindowsAPI的封装来实现自己需要的控件，同时设计出自己消息响应机制。

DirectUI的两大特点，其一是 Windowless理念带来的安全性，另外一个就是界面和逻辑分离为开发带来的高效性。 DirectUI使用XML文件来描述界面显示，通过编程语言来描述界面逻辑。这使得开发效率得到了提高，同时对于为后期的维护降低了工作量。
</code></pre>
<p>对于不同的UI库， 单纯讨论每个库的优劣是没有意义的，而是要放到具体的应用场景里来看，每个库都有自己擅长的场景。 目前 大多数C++的DirectUI停留在XML配置静态UI，然后C++来实现后台逻辑。</p>
<p>DirectUI还有以下优点，基于Win32API，没有framework依赖。易于改变皮肤色调。支持大多数控件透明，包括子窗口透明。</p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/duilib/" rel="tag"># duilib</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2020/11/16/Git-%E5%AD%A6%E4%B9%A0%E8%AE%B0%E5%BD%95/" rel="prev" title="Git学习记录">
                  <i class="fa fa-chevron-left"></i> Git学习记录
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021/11/24/Windows-OS-Handle/" rel="next" title="Windows OS Handle">
                  Windows OS Handle <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">lee</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/pisces/" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script>

  





  





</body>
</html>
